<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>

<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&#32;</xsl:text>
</xsl:template>
<xsl:template match='quote' name='quote'>
<xsl:text disable-output-escaping='yes'>&gt;</xsl:text>
</xsl:template>
<xsl:template match='crlf' name='crlf'>
<xsl:text disable-output-escaping='yes'>&#10;</xsl:text>
</xsl:template>

<xsl:include href='../xsl.include.main.xsl'/>

<xsl:template name="followupSplit">
 <xsl:param name="text"/>
 <xsl:param name="ck"/>
 <xsl:param name="illo"/>
 <xsl:choose>
   <xsl:when test="contains($text,$illo)">
							 <xsl:value-of select="substring-before($text,$illo)"/>
 <xsl:choose>
   <xsl:when test="1 + $ck + string-length( substring-before($text,$illo) ) &gt; 36">
			<xsl:call-template name="crlf"/>
			<xsl:call-template name="quote"/>
			<xsl:call-template name="followupSplit">
				<xsl:with-param name="text"><xsl:value-of select="substring-after($text,$illo)"/></xsl:with-param>
				<xsl:with-param name="ck"><xsl:value-of select="0"/></xsl:with-param>
				<xsl:with-param name="illo">&#160;</xsl:with-param>
			</xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
			<xsl:call-template name="nbsp"/>
     <xsl:call-template name="followupSplit">
       <xsl:with-param name="text"><xsl:value-of select="substring-after($text,$illo)"/></xsl:with-param>
			 <xsl:with-param name="ck"><xsl:value-of select="1+ $ck + string-length( substring-before($text,$illo) )"/></xsl:with-param>
			 <xsl:with-param name="illo">&#160;</xsl:with-param>
     </xsl:call-template>
   </xsl:otherwise>
 </xsl:choose>
   </xsl:when>
   <xsl:otherwise>
							<xsl:value-of select="$text"/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template name="followup">
 <xsl:param name="text"/>
 <xsl:choose>
   <xsl:when test="contains($text,'&#10;')">
					 <xsl:call-template name="quote"/>
					 <xsl:call-template name="followupSplit">
						 <xsl:with-param name="text"><xsl:value-of select="normalize-space( translate( substring-before($text,'&#10;') ,'&#32;','&#160;' ) )"/></xsl:with-param>
						 <xsl:with-param name="ck">1</xsl:with-param>
						 <xsl:with-param name="illo">&#160;</xsl:with-param>
		     </xsl:call-template>
			<xsl:call-template name="crlf"/>
     <xsl:call-template name="followup">
      <xsl:with-param name="text"><xsl:value-of select="substring-after($text,'&#10;')"/></xsl:with-param>
     </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
					 <xsl:call-template name="quote"/>
					 <xsl:call-template name="followupSplit">
						 <xsl:with-param name="text"><xsl:value-of select="normalize-space( translate( $text, '&#32;', '&#160;' ) )"/></xsl:with-param>
						 <xsl:with-param name="ck">1</xsl:with-param>
						 <xsl:with-param name="illo">&#160;</xsl:with-param>
		     </xsl:call-template>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template match="mailboxwrite">

	<xsl:if test='(floor( /mailboxwrite/@settings div 16 ) mod 2) and /mailboxwrite/@isBuddy = "False"  and not (@authlevel &gt; 0)'>
<div style="
background-color: #f4efdf;
border-top:1px solid #787878; border-left: 1px solid #787878; border-right: 1px solid #787878; border-bottom:1px solid #787878;
padding-top: 5px;padding-left: 5px;padding-right: 5px;padding-bottom: 5px;
font-family:tahoma;
font-size:12pt;
"><xsl:value-of select="@receiverNick"/> ha scelto di ricevere messaggi solo dai propri amichetti/amichette.<br/>
Se vuoi puoi inviarle/inviargli il seguente messaggio per richiedere di essere aggiunto/a alla lista dei suoi amichetti/amichette!
</div><p/>
	</xsl:if>

<form name="formmailboxwrite" method="post" action="{@action}">
<div style="padding: 2% 0px 0px 2%; background: #C3D9FF; text-align:left;">
	<div style="width:8em;float:left;"><xsl:value-of select="from/@descr"/></div>
	<div>
	<input value="{/mailboxwrite/@senderNick}" type="text" name="T5" style="width:50%;" maxlength="20" readonly="true"></input>
	</div>
	<div class="b10b" style="padding-left:95px; color:gray;">(tuo indirizzo ip: <xsl:value-of select="/mailboxwrite/@senderIP"/>)</div>
</div>
<div style="padding: 10px 0px 2% 2%; background: #C3D9FF; text-align:left;">
	<div style="width:8em;float:left;"><xsl:value-of select="to/@descr"/></div>
	<div>
	<input value="{/mailboxwrite/@receiverNick}" type="text" name="{concat('T',@ID)}" style="width:50%;" maxlength="20" readonly="true"></input>
	</div>
</div>
<div style="padding: 0px 2% 2% 2%; background: #C3D9FF; text-align:left;">
	<span class="b10b" style="color:gray;"><xsl:value-of select="subject/@descr"/></span>
	<xsl:choose>
		<xsl:when test='/mailboxwrite/@subject!=""'><input value="{/mailboxwrite/@subject}" type="text" name="T3" style="width:100%;" maxlength="256"></input></xsl:when>
		<xsl:when test='((floor( /mailboxwrite/@settings div 16 ) mod 2) and /mailboxwrite/@isBuddy = "False") and not (/mailboxwrite/@authlevel &gt; 0)'><input value="Mi vuoi tra i tuoi amichetti?" type="text" name="T3" style="width:100%;" maxlength="256" readonly="true"></input></xsl:when>
		<xsl:otherwise><input type="text" name="T3" style="width:100%;" maxlength="256"></input></xsl:otherwise>
	</xsl:choose>
</div>
<div style="padding: 0px 2% 2% 2%; background: #C3D9FF; text-align:left;">
			<xsl:choose>
			  <xsl:when test='(floor( /mailboxwrite/@settings div 16 ) mod 2) and /mailboxwrite/@isBuddy = "False" and not (/mailboxwrite/@authlevel &gt; 0)'><TEXTAREA style="width:100%;" id="TA4" name="TA4" rows="20" WRAP="SOFT" readonly="true">
Ciao, <xsl:value-of select="/mailboxwrite/@senderNick"/> vorrebbe comunicare con te, ma le attuali impostazioni del tuo profilo consentono solo ai tuoi amichetti di inviarti messaggi privati.
<xsl:call-template name="crlf"/><xsl:call-template name="crlf"/><xsl:value-of select="/mailboxwrite/@senderNick"/> vorrebbe che tu lo/la inserissi nella lista dei tuoi amichetti/amichette per poter comunicare con te.
<xsl:call-template name="crlf"/><xsl:call-template name="crlf"/>Visita il suo profilo e se lo vuoi, aggiungilo agli amichetti/amichette.
			  </TEXTAREA></xsl:when>
			  <xsl:when test='/mailboxwrite/@body'>
			  <div style="width:100%">
			  <TEXTAREA style="width:100%;" id="TA4" name="TA4" rows="20" WRAP="SOFT">
				  <xsl:value-of select="/mailboxwrite/@body"/>
			  </TEXTAREA>
			  </div>
		<span style="font-size:8pt; color:gray; width:100%; text-align:right;"><a tabindex="-1" style="color:gray;" href="/help/somehtml.aspx"><xsl:value-of select="body/@part01"/><b><xsl:value-of select="body/@part02"/></b></a><xsl:value-of select="body/@part03"/></span>
			  </xsl:when>
			  <xsl:otherwise><TEXTAREA style="width:100%;" id="TA4" name="TA4" rows="20" WRAP="SOFT"></TEXTAREA>
			  </xsl:otherwise>
			</xsl:choose>
</div>
<div style="padding: 0px 2% 2% 2%; background: #C3D9FF; text-align:left;">
		<input type="submit" style="visibility:hidden;position:absolute;z-index:-1;margin:8px; width:50px;" disabled="true" name="WAIT" id="WAIT" value="Wait..."/>
		<input type="submit" onclick="javascript:this.style.visibility='hidden';document.getElementById('WAIT').style.visibility='visible';document.getElementById('WAIT').style.zIndex=1" style="z-index:1; margin:8px; width:50px;" name="SUBMIT5" value="{submit/@descr}"></input>
<!--				<input type="submit" style=" margin:8px; width:100px; color:#444444;" name="PREVIEW" id="PREVIEW" value="{preview/@descr}"></input>!-->
		<input type="hidden" name="receiverGuid" value="{/mailboxwrite/@receiverGuid}"></input>
		<input type="hidden" name="receiverNick" value="{/mailboxwrite/@receiverNick}"></input>
		<input type="hidden" name="imailEnabled" value="{/mailboxwrite/@imailEnabled}"></input>
		<input type="hidden" name="msgid" value="{/mailboxwrite/@msgid}"></input>
</div>

</form>

			<xsl:choose>
			  <xsl:when test='/mailboxwrite/@preview = 1'>

			  </xsl:when>
			  <xsl:otherwise>
			  </xsl:otherwise>
			</xsl:choose>

</xsl:template>


</xsl:stylesheet>